/**
 * 通用类型定义
 */

export interface ApiResponse<T> {
  code: number;
  message: string;
  msg?: string; // 后端可能会返回msg而不是message
  data: T;
  time?: number; // 后端会返回时间戳
}

export interface Pagination {
  page: number;
  pageSize: number;
  total: number;
}

export interface QueryParams {
  page?: number;
  pageSize?: number; // 保留兼容性
  limit?: number;    // 添加与后端一致的参数名
  [key: string]: any;
}

export interface BaseResult {
  success: boolean;
  message?: string;
}

// 通用响应状态
export interface ResponseStatus {
  loading: boolean;
  error: string | null;
  success: boolean;
}

// 通用列表响应
export interface ListResponse<T> {
  items: T[];
  total: number;
  page: number;
  pageSize: number;
  hasMore: boolean;
}

// 通用筛选参数
export interface FilterParams {
  search?: string;
  category?: string;
  sortBy?: string;
  sortOrder?: 'asc' | 'desc';
  page?: number;
  pageSize?: number;
}
